Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

object.reduce

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object.reduce

Reduces an object to a value that is the accumulated result of running each property in the object through a callback.

  • 0.1.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1M
decreased by-17.96%
Maintainers
1
Weekly downloads
 
Created
Source

object.reduce NPM version

Reduces an object to a value that is the accumulated result of running each property in the object through a callback.

Executes the callback function once for each own enumerable property in the object, receiving four arguments: the initial value (or value from the previous callback call), the value of the current property, the key of the current property, and the object over which the function is iterating. Node.js/JavaScript utility.

Install with npm

npm i object.reduce --save

Install with bower

bower install object.reduce --save

Usage

A callback function is executed once for each own enumerable property in the object, receiving four arguments:

  • acc: the initial value (or value from the previous callback call),
  • value: the of the current property,
  • key: the of the current property, and
  • the original object over which the function is iterating.

Example

var reduce = require('object.reduce');
var a = {a: 'foo', b: 'bar', c: 'baz'};

reduce(a, function (acc, value, key, obj) {
  acc[key] = value.toUpperCase();
  return acc;
}, {});

//=> {a: 'FOO', b: 'BAR', c: 'BAZ'};

Running tests

Install dev dependencies:

npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on April 25, 2015.

Keywords

FAQs

Package last updated on 25 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc